package com.jsm.tf;

import com.jsm.tf.director.Director;
import com.jsm.tf.view.IndexView;
import de.felixroske.jfxsupport.AbstractJavaFxApplicationSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import tk.mybatis.spring.annotation.MapperScan;

@MapperScan(basePackages = "com.jsm.tf.mapper")
@SpringBootApplication()
public class TfClientApplication extends AbstractJavaFxApplicationSupport {
    @Autowired
    Director director;

    public static void main(String[] args) {
//        initDefaultUncaughtExceptionHandler();
        launch(TfClientApplication.class, IndexView.class, args);
    }

    @Override
    public void stop() throws Exception {

        super.stop();
    }
    //    private static void initDefaultUncaughtExceptionHandler() {
//        Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
//            if(e instanceof BusinessException){
//                e.printStackTrace();
//                TFDialog.showMessageDialog(GUIState.getStage(),e.getMessage(),((BusinessException) e).getTitle());
//            }if(e instanceof RuntimeException){
//                e.printStackTrace();
//                if(e.getCause()!=null&&e.getCause().getCause()!=null&&e.getCause().getCause() instanceof BusinessException){
//                    TFDialog.showMessageDialog(GUIState.getStage(),((BusinessException)e.getCause().getCause()).getErrorMsg(),((BusinessException)e.getCause().getCause()).getTitle());
//                }
//            }else {
//                e.printStackTrace();
//                TFDialog.showMessageDialog(GUIState.getStage(),e.getCause().getMessage(),"服务器异常");
//            }
//        });
//    }


}
